
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<HEAD>
   <TITLE>spk14e_c</TITLE>
</HEAD>

<BODY style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<A name="TOP"></A>

<table style="text-align: left; margin-left: auto; margin-right: auto; width: 800px;"
 border="0" cellpadding="5" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(153, 153, 153); vertical-align: middle; text-align: center;">
      <div align="right"> 
      <small><small><a href="index.html">Index Page</a></small></small>
      </div>
      <b>spk14e_c</b> </td>
    </tr>

    <tr>
      <td style="vertical-align: top;">

<small><div align="center">
<A HREF="index.html#A">A</A>&nbsp;
<A HREF="index.html#B">B</A>&nbsp;
<A HREF="index.html#C">C</A>&nbsp;
<A HREF="index.html#D">D</A>&nbsp;
<A HREF="index.html#E">E</A>&nbsp;
<A HREF="index.html#F">F</A>&nbsp;
<A HREF="index.html#G">G</A>&nbsp;
<A HREF="index.html#H">H</A>&nbsp;
<A HREF="index.html#I">I</A>&nbsp;
<A HREF="index.html#J">J</A>&nbsp;
<A HREF="index.html#K">K</A>&nbsp;
<A HREF="index.html#L">L</A>&nbsp;
<A HREF="index.html#M">M</A>&nbsp;
<A HREF="index.html#N">N</A>&nbsp;
<A HREF="index.html#O">O</A>&nbsp;
<A HREF="index.html#P">P</A>&nbsp;
<A HREF="index.html#Q">Q</A>&nbsp;
<A HREF="index.html#R">R</A>&nbsp;
<A HREF="index.html#S">S</A>&nbsp;
<A HREF="index.html#T">T</A>&nbsp;
<A HREF="index.html#U">U</A>&nbsp;
<A HREF="index.html#V">V</A>&nbsp;
<A HREF="index.html#W">W</A>&nbsp;
<A HREF="index.html#X">X</A>&nbsp;
</div></small>
       <br>
       <table style="text-align: left; width: 60%; margin-left: auto; margin-right: auto;"
       border="0" cellspacing="2" cellpadding="2">
        <tbody>
          <tr>
            <td style="width: 50%; text-align: center;">
            <small>
              <a href="#Procedure">Procedure<br></a>
              <a href="#Abstract">Abstract<br></a>
              <a href="#Required_Reading">Required_Reading<br></a>
              <a href="#Keywords">Keywords<br></a>
              <a href="#Brief_I/O">Brief_I/O<br></a>
              <a href="#Detailed_Input">Detailed_Input<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Detailed_Output">Detailed_Output<br></a>
              <a href="#Parameters">Parameters<br></a>
              <a href="#Exceptions">Exceptions<br></a>
              <a href="#Files">Files<br></a>
              <a href="#Particulars">Particulars<br></a>
              <a href="#Examples">Examples<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Restrictions">Restrictions<br></a>
              <a href="#Literature_References">Literature_References<br></a>
              <a href="#Author_and_Institution">Author_and_Institution<br></a>
              <a href="#Version">Version<br></a>
              <a href="#Index_Entries">Index_Entries<br></a>
             </small>
            </td>
          </tr>
        </tbody>
</table>

<h4><a name="Procedure">Procedure</a></h4>
<PRE>
   void spk14e_c ( SpiceInt   handle ) 

</PRE>
<h4><a name="Abstract">Abstract</a></h4>
<PRE>
 
   End the type 14 SPK segment currently being written to the SPK 
   file associated with handle. See also <a href="spk14a_c.html">spk14a_c</a> and <a href="spk14b_c.html">spk14b_c</a>. 
 </PRE>
<h4><a name="Required_Reading">Required_Reading</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Keywords">Keywords</a></h4>
<PRE>
 
   SPK 
 

</PRE>
<h4><a name="Brief_I/O">Brief_I/O</a></h4>
<PRE>
 
   VARIABLE  I/O  DESCRIPTION 
   --------  ---  -------------------------------------------------- 
   handle     I   The handle of an SPK file open for writing. 
 </PRE>
<h4><a name="Detailed_Input">Detailed_Input</a></h4>
<PRE>
 
   handle   is the file handle of an SPK file that has been 
            opened for writing, and to which a type 14 segment is 
            being written. 
 </PRE>
<h4><a name="Detailed_Output">Detailed_Output</a></h4>
<PRE>
 
   None.    The type 14 segment in the SPK file associated with 
            handle will be ended, making the addition of the data 
            to the file permanent. 
 
            See the Particulars section for details about the 
            structure of a type 14 SPK segment. 
 </PRE>
<h4><a name="Parameters">Parameters</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Exceptions">Exceptions</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Files">Files</a></h4>
<PRE>
 
   See the argument handle. 
 </PRE>
<h4><a name="Particulars">Particulars</a></h4>
<PRE>
 
   This routine ends a type 14 SPK segment which is being written to 
   the SPK file associated with handle. Ending the SPK segment is a 
   necessary step in the process of making the data a permanent part 
   of the SPK file. 
 
   This routine is one of a set of three routines for creating and 
   adding data to type 14 SPK segments. These routines are: 
 
      <a href="spk14b_c.html">spk14b_c</a>: Begin a type 14 SPK segment. This routine must be 
                called before any data may be added to a type 14 
                segment. 
 
      <a href="spk14a_c.html">spk14a_c</a>: Add data to a type 14 SPK segment. This routine may be 
                called any number of times after a call to SPK14B to 
                add type 14 records to the SPK segment that was 
                started. 
 
      <b>spk14e_c</b>: End a type 14 SPK segment. This routine is called to 
                make the type 14 segment a permanent addition to the 
                SPK file. Once this routine is called, no further type 
                14 records may be added to the segment. A new segment 
                must be started. 
 
   A type 14 SPK segment consists of coefficient sets for fixed order 
   Chebyshev polynomials over consecutive time intervals, where the 
   time intervals need not all be of the same length. The Chebyshev 
   polynomials represent the position, X, Y, and Z coordinates, and 
   the velocities, dX/dt, dY/dt, and dZ/dt, of a body relative to a
   center of motion. 
 
   The ephemeris data supplied to the type 14 SPK writer routines is 
   packed into an array as a sequence of logical records, 
 
      ----------------------------------------------------- 
      | Record 1 | Record 2 | ... | Record N-1 | Record N | 
      ----------------------------------------------------- 
 
   with each record has the following format. 
 
      ------------------------------------------------ 
      |  the midpoint of the approximation interval  | 
      ------------------------------------------------ 
      |   the radius of the approximation interval   | 
      ------------------------------------------------ 
      |  CHBDEG+1 coefficients for the X coordinate  | 
      ------------------------------------------------ 
      |  CHBDEG+1 coefficients for the Y coordinate  | 
      ------------------------------------------------ 
      |  CHBDEG+1 coefficients for the Z coordinate  | 
      ------------------------------------------------ 
      |   CHBDEG+1 coefficients for the X velocity   | 
      ------------------------------------------------ 
      |   CHBDEG+1 coefficients for the Y velocity   | 
      ------------------------------------------------ 
      |   CHBDEG+1 coefficients for the Z velocity   | 
      ------------------------------------------------ 
 </PRE>
<h4><a name="Examples">Examples</a></h4>
<PRE>
 
   Assume we have the following for each of the examples that 
   follow. 
 
      handle   is the handle of an SPK file opened with write 
               access. 
 
      segid    is a character string of no more than 40 characters 
               which provides a pedigree for the data in the SPK 
               segment we will create. 
 
      body     is the NAIF ID code for the body whose ephemeris 
               is to be placed into the file. 
 
      center   is the center of motion for the ephemeris of body. 
 
      reffrm   is the name of the SPICE reference frame for the 
               ephemeris. 
 
      first    is the starting epoch, in seconds past J2000, for 
               the ephemeris data to be placed into the segment. 
 
      last     is the ending epoch, in seconds past J2000, for 
               the ephemeris data to be placed into the segment. 
 
   Example 1: 
 
      For this example, we also assume that: 
 
         n        is the number of type 14 records that we want to 
                  put into a segment in an SPK file. 
 
         recrds   contains n type 14 records packaged for the SPK 
                  file. 
 
         etstrt   contains the initial epochs for each of the 
                  records contained in RECRDS, where 
 
                     etstrt[i] &lt; etstrt[i+1], i = 0, n-2 
 
                     etstrt[1] &lt;= first, etstrt[n-1] &lt; last 
 
                     etstrt[i+1], i = 0, n-2, is the ending epoch for 
                     record i as well as the initial epoch for record 
                     i+1. 
 
      Then the following code fragment demonstrates how to create a 
      type 14 SPK segment if all of the data for the segment is 
      available at one time. 
 
         #include &quot;SpiceUsr.h&quot;
            .
            .
            .
         
         #define SPK  &quot;example.bsp&quot;
            
         /.
         If the segment is to be appended to an existing file, open
         that file for &quot;append&quot; access.  Otherwise, create a new file.
         ./
         
         if ( <a href="exists_c.html">exists_c</a>(SPK) )
         {
            <a href="spkopa_c.html">spkopa_c</a> ( SPK, &amp;handle );
         } 
         else
         {
            /.
            New files are supplied with an internal file name.  
            Comment area space may be reserved at this time; the
            units are characters.
            ./
            ifname = &quot;Sample type 14 SPK file.&quot;;
            ncomch = 1024;
            
            <a href="spkopn_c.html">spkopn_c</a> ( SPK, ifname, ncomch, &amp;handle );
         }
          
          
         /.
         Begin the segment. 
         ./
         <a href="spk14b_c.html">spk14b_c</a> ( handle, segid, body, center, reffrm, 
                    first,  last,  chbdeg               );
       
         /.
         Add the data to the segment all at once. 
         ./
         <a href="spk14a_c.html">spk14a_c</a> ( handle, n, recrds, etstrt ); 
      
         /.
         End the segment, making the segment a permanent addition 
         to the SPK file. 
         ./
         <b>spk14e_c</b> ( handle ); 
         
             .
             .
             .
         /.
         After all segments have been loaded, close the SPK file.
         ./
         <a href="spkcls_c.html">spkcls_c</a> ( handle );
         
 
   Example 2: 
 
      In this example we want to add type 14 SPK records, as described
      above in the Particulars section, to the segments being written
      as they are generated.  The ability to write the records in this
      way is useful if computer memory is limited. It may also be
      convenient from a programming perspective to write the records
      one at a time.
 
      For this example, assume that we want to generate n type 14 SPK 
      records, one for each of n time intervals, writing them all to 
      the same segment in the SPK file. Let 
 
         n        be the number of type 14 records that we want to 
                  generate and put into a segment in an SPK file. 
 
         record   be an array with enough room to hold a single type 
                  14 record, i.e. record should have dimension at 
                  least 6 * (chbdeg + 1 ) + 2. 
 
         start    be an array of n times that are the beginning 
                  epochs for each of the intervals of interest. The 
                  times should be in increasing order and the start 
                  time for the first interval should equal the 
                  starting time for the segment. 
 
                     start[i] &lt; start[i+1], i = 0, n-2 
 
                     start[0] = first 
 
         stop     be an array of n times that are the ending epochs 
                  for each of the intervals of interest. The times 
                  should be in increasing order and the stop time for 
                  interval i should equal the start time for interval 
                  i+1, i.e., we want to have continuous coverage in 
                  time across all of the records. Also, the stop time 
                  for the last interval should equal the ending time 
                  for the segment. 
 
                     stop[i]   &lt; stop [i+1], i = 0, n-2 
 
                     stop[i]   = start[i+1], i = 0, n-2 
 
                     stop[n-1] = last 
 

         genrec( time1, time2, record ) 
 
                  be a subroutine that generates a type 14 SPK record 
                  for a time interval specified by time1 and time2. 
 

      Then the following code fragment demonstrates how to create a 
      type 14 SPK segment if all of the data for the segment is not 
      available at one time. 
 
         #include &quot;SpiceUsr.h&quot;
            .
            .
            .
        
         /.
         Begin the segment. 
         ./
         <a href="spk14b_c.html">spk14b_c</a> ( handle, segid, body, center, reffrm, 
                    first,  last,  chbdeg                ); 
 
        
         /.
         Generate the records and write them to the segment in the 
         SPK file one at at time. 
         ./   
         
         for ( i = 0;  i &lt; n;  i++ )
         {
            genrec   ( start[i],    stop[i], record  ); 
            <a href="spk14a_c.html">spk14a_c</a> ( handle,   1, record,  start+i );
         }
 
         /.
         End the segment, making the segment a permanent addition 
         to the SPK file. 
         ./   
         <b>spk14e_c</b> ( handle );
 </PRE>
<h4><a name="Restrictions">Restrictions</a></h4>
<PRE>
 
   1) The type 14 SPK segment being closed must have been started by 
      the routine <a href="spk14b_c.html">spk14b_c</a>, the routine which begins a type 14 SPK 
      segment. 
 </PRE>
<h4><a name="Literature_References">Literature_References</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Author_and_Institution">Author_and_Institution</a></h4>
<PRE>
 
   N.J. Bachman        (JPL)
   K.R. Gehringer      (JPL) 
 </PRE>
<h4><a name="Version">Version</a></h4>
<PRE>
 
   -CSPICE Version 1.0.1, 16-JAN-2003 (EDW)

       Trivial correction to the header.

   -CSPICE Version 1.0.0, 29-JUL-1999 (NJB) (KRG)
</PRE>
<h4><a name="Index_Entries">Index_Entries</a></h4>
<PRE>
 
   end a type_14 spk segment 
 </PRE>
<h4>Link to routine spk14e_c source file <a href='../../../src/cspice/spk14e_c.c'>spk14e_c.c</a> </h4>

      </td>
    </tr>
  </tbody>
</table>

   <pre>Wed Jun  9 13:05:29 2010</pre>

</body>
</html>

